﻿<%@ page contentType="text/html; charset=utf-8" %>

<script type="text/javascript">
	var isAreaLeavedBlank = false;
	var percentage = ${tpr.percentIntValue};
	var colorOfPercentage = getColorByPercent(percentage);
	
	//对大区进行后期渲染->
	<c:if test="${adminDivLevelDeep == 6}">
	var currentArea = ${status.count};
		for (var state in china) {
			var area = china[state]['area'];
			var nameTmp = china[state]['name'];//此处变量名不能使用name,发现一个Chrom浏览器的Bug,使用name变量名会导致浏览器异常,弹出新的标签页
			if (area == currentArea) {
				china[state]['path'].attr("fill", colorOfPercentage);
			}
			
			if (nameTmp == "台湾省" || nameTmp == "香港特区" || nameTmp == "澳门特区") {
				china[state]['path'].attr("fill", "rgb(255,0,0)");//台湾、香港、澳门等特别行政区
			}
		}
	</c:if>
	//<-
	
	//对大区的下属明细省市进行后期渲染(由大区进入)->
	<c:if test="${adminDivLevelDeep == 1 and !empty standardAdminDivAreaCode}">
	var currentAreaCode = ${tpr.adminDivAreaCode};
		for (var state in china) {
			var code = china[state]['code'];
			var nameTmp = china[state]['name'];//此处变量名不能使用name,发现一个Chrom浏览器的Bug,使用name变量名会导致浏览器异常,弹出新的标签页
			//对大区相关省市区域进行着色
			if (code == currentAreaCode) {
				china[state]['path'].attr("fill", colorOfPercentage);
				
				//对其它大区的省市进行灭色处理，并且局部只做一次->
				if (isAreaLeavedBlank == false) {
					var currentArea = china[state]['area'];
					for (var state in china) {
						var area = china[state]['area'];		
						if (area != currentArea) {
							china[state]['path'].attr("fill", "rgb(245,245,245)");
						}
					}
					isAreaLeavedBlank = true;
				}
				//<-
			}
			
			if (nameTmp == "台湾省" || nameTmp == "香港特区" || nameTmp == "澳门特区") {
				china[state]['path'].attr("fill", "rgb(255,0,0)");//台湾、香港、澳门等特别行政区
			}
		}
	</c:if>
	//<-
	
	//对各明细省市进行后期渲染(非大区进入)->
	<c:if test="${adminDivLevelDeep == 1 and empty standardAdminDivAreaCode}">
	var currentAreaCode = ${tpr.adminDivAreaCode};
		for (var state in china) {
			var code = china[state]['code'];
			var nameTmp = china[state]['name'];//此处变量名不能使用name,发现一个Chrom浏览器的Bug,使用name变量名会导致浏览器异常,弹出新的标签页
			//对各省市区域进行着色			
			if (code == currentAreaCode) {
				china[state]['path'].attr("fill", colorOfPercentage);
			}
			
			if (nameTmp == "台湾省" || nameTmp == "香港特区" || nameTmp == "澳门特区") {
				china[state]['path'].attr("fill", "rgb(255,0,0)");//台湾、香港、澳门等特别行政区
			}
		}
	</c:if>
	//<-
</script>